Extend coof cascade eligibility to strategy.exit orders (KI-67)#98
Merged
Conversation
PR#95 gave calc_on_order_fills ENTRY orders cascade eligibility on the historical 4-tick path but it never reached strategy.exit: the engine rolled 100% of exits placed by a mid-bar fill recalc, even those whose level sits at a remaining extreme. TradingView does not. A clean-room probe (pf-probe-ki67-exitlim-midseg, 4,851 TV trades) pins the rule, Model S "R-cascade-gapjump": After an intrabar fill at price ap triggers a coof recalc, the emulator resumes the O->W1->W2->C proximity path from ap. A priced exit placed at that recalc is held on its in-flight leg's remainder; gap-fills same-bar at the leg-end waypoint when its level lies in that remainder (limits better than the level, stops worse); exact-level fills on every subsequent leg; and a terminal in-flight leg (-> C) or off-path fill rolls to the next bar. The in-flight leg is read from the dispatch cursor's real position, not re-derived from the fill price (which is ambiguous when the fill lands exactly on a waypoint). Market/close and trailing cascade exits keep the plain extreme-waypoint reach; the bar-magnifier path is scoped out. Gates: ki67-exitlim-midseg 36.8% -> 98.8% (canonical 100.0, exit/pnl p90 -> 0); coof-refill-depth 85.7% -> 99.8%; coof cohort byte-identical (md5-verified fran/jenmb/delta/mrwick/wayward); corpus 240/11/1 zero movement; R7 3commas sentinels byte-identical. A WP-control residual (exit level = a dynamic high/low series) remains, distinct from the fixed-level rule and within canonical tolerance. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PR#95 gave calc_on_order_fills ENTRY orders cascade eligibility on the historical 4-tick path, but it never reached
strategy.exit: the engine rolled 100% of exits placed by a mid-bar fill recalc — even those whose level sits at a remaining extreme. TradingView does not.A clean-room probe (pf-probe-ki67-exitlim-midseg, 4,851 TV trades) pins the rule, Model S "R-cascade-gapjump" (4,848/4,850 = 99.96% event-level): after an intrabar fill at price p triggers a coof recalc, the emulator resumes the O→W1→W2→C proximity path from p. A priced
strategy.exitplaced at that recalc gap-fills same-bar at the in-flight leg-end waypoint when its level lies in the leg remainder (limits AND stops); fills same-bar at the exact level on subsequent legs; a terminal in-flight leg or off-path level rolls to next bar. The in-flight leg is read from the dispatch cursor's real position (price re-derivation is ambiguous at waypoint fills). Market/close and trailing cascade exits keep PR#95's extreme-waypoint reach; scope is narrowed toOrderType::EXIT(opposing rawstrategy.orderbrackets keep PR#95 behavior — unpinned class, per review). Bar-magnifier path untouched.Verification
Known residuals (recorded, non-blocking per review)
🤖 Generated with Claude Code